-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
deck: used fisher-yates algorithm to shuffle deck array #13
Closed
sethdivyansh
wants to merge
2
commits into
shivansh-bhatnagar18:master
from
sethdivyansh:fix/issue-#2
Closed
deck: used fisher-yates algorithm to shuffle deck array #13
sethdivyansh
wants to merge
2
commits into
shivansh-bhatnagar18:master
from
sethdivyansh:fix/issue-#2
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sethdivyansh
force-pushed
the
fix/issue-#2
branch
from
May 28, 2024 15:30
38a68d9
to
73a5f1c
Compare
Varun-Kolanu
force-pushed
the
master
branch
2 times, most recently
from
May 28, 2024 16:56
f828c52
to
a008630
Compare
sethdivyansh
force-pushed
the
fix/issue-#2
branch
from
May 30, 2024 12:49
73a5f1c
to
5845678
Compare
kuv2707
reviewed
May 31, 2024
backend/uno-game-engine/deck.ts
Outdated
@@ -66,5 +66,9 @@ function makeCard(type: CardType, color: CardColor, value: CardValue): UNOCard { | |||
*/ | |||
function shuffle(deck: Array<any>) { | |||
//todo: Implement a generic shuffling algorithm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this comment
kuv2707
reviewed
May 31, 2024
backend/uno-game-engine/deck.ts
Outdated
@@ -66,5 +66,9 @@ function makeCard(type: CardType, color: CardColor, value: CardValue): UNOCard { | |||
*/ | |||
function shuffle(deck: Array<any>) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any
would cause eslint errors.
sethdivyansh
changed the title
used fisher-yates algo to shuffle deck array
deck: used fisher-yates algorithm to shuffle deck array
May 31, 2024
sethdivyansh
force-pushed
the
fix/issue-#2
branch
from
May 31, 2024 16:37
5845678
to
98d809c
Compare
- added black as a color in `CardColor` in `types.d.ts` - separated the values of special cards and wild cards into two arrays named specialValues and wildCardValues, respectively. - Iterates over each color in the colors array. For each color: * Iterates over each number value (0 to 9) in the numValues array and adds two cards of that color for each number, except for '0' where only one card is added. * Iterates over each special value in the specialValues array and adds two cards of that color for each special value. * If the color is 'black', iterates over each wild card value in the wildCardValue array and adds four cards of that color for each wild card value.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #2
used Fisher-Yates shuffle algorithm to shuffle the deck array.
Self-review checklist
Completed manual review and testing of the following: